package lanQiaoBei.数据结构.trie树;

import java.io.*;
/*最大异或对
 * 给定的n个整数A1,A2,A3.....中选出两个数进行异或运算，得到的结果最大是多少
 * 输入格式：
 * 第一行输入一个整数N
 * 第二行输入N个整数
 * 输出格式：
 *输出一个整数表示答案
 * */

public class P2 {
    final static int N = 100010, M = 3 * N;
    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    static int n, idx;
    static int[] a = new int[N];
    static int[][] son = new int[M][2];

    static void scan() throws Exception {
        n = Integer.parseInt(br.readLine());
        String[] ss = br.readLine().split(" ");
        for (int i = 0; i < n; i++)
            a[i] = Integer.parseInt(ss[i]);
    }
    static void insert(int x) {
        int p = 0;
        for (int i = 30; i >= 0; i--) {
            int z = x >> i & 1;
            if (son[p][z] <= 0) son[p][z] = ++idx;
            p = son[p][z];
        }
    }
    static int query(int x) {
        int p = 0, res = 0;
        for (int i = 30; i >= 0; i--) {
            int z = x >> i & 1;
            int nz = ~z + 2;//!z
            if (son[p][nz] > 0) {
                p = son[p][nz];
                res = res * 2 + nz;
            } else {
                p = son[p][z];
                res = res * 2 + z;
            }
        }
        return res;
    }
    public static void main(String[] args) throws Exception {
        scan();
        int res = 0;
        for (int i = 0; i < n; i++) {
            insert(a[i]);
            int t = query(a[i]);
            res = Math.max(res, t ^ a[i]);
        }
        System.out.print(res);
    }
}
